package xyz.jcat.biz.admin.auth;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import xyz.jcat.biz.admin.service.IRolePermissionService;
import xyz.jcat.web.security.annotation.AbstractAuthAnnotationAccessDecisionVoter;

import java.util.List;

@Component
public class AuthAnnotationAccessDecisionVoter extends AbstractAuthAnnotationAccessDecisionVoter {

    @Autowired
    private IRolePermissionService rolePermissionService;
    @Override
    public List<Long> getPermissionRoles(String permission) {
        return rolePermissionService.getRoleIdsByPermission(permission);
    }
}
